import { deepCopy } from "../lib/utils"
import styleFilter from "./styleFilter"
import { setEventVm } from "./commonAttr"
// 定义一个混入对象
const customMixin = {
  props: {
    index: {
      type: Number,
      default: 0,
    },
    value: {
      type: String,
      default: "",
    },
    element: {
      type: Object,
      default: () => {}
    },
    isPreview: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    styleFilter,
    // 封装events对象,为handle添加vue实例对象
    setEventVm(){
      const {
        events,
      } = this.element
      return setEventVm(events,this)
    }
  },
  // mounted() {
  //   const {events} = this.element
  //   console.log(events)
  //   // 通过 forEach 遍历绑定多个事件
  //   Object.keys(events).forEach((event) => {
  //     this.$on(event, events[event])
  //     console.log(`this.$on(${event}, ${events[event]})`)
  //   })
  // }
}

export default customMixin
